 const multer = require('multer')
 const path = require('path')

 const bannerStorage = multer.diskStorage({
     destination(req,file,cb){
        cb(null,path.resolve(__dirname,'../public/banner/'))
     },
     filename(req,file,cb){
         const {ext}=path.parse(file.originalname)
        const filename=`banner_${Date.now()}_${Math.random().toString().slice(2)}${ext}`
        cb(null,filename)
     }
 })
 const avatarStorage = multer.diskStorage({
   destination(req,file,cb){
      cb(null,path.resolve(__dirname,'../public/avatar/'))
   },
   filename(req,file,cb){
       const {ext}=path.parse(file.originalname)
      const filename=`avatar_${Date.now()}_${Math.random().toString().slice(2)}${ext}`
      cb(null,filename)
   }
})
 module.exports={
    bannerUpload:multer({storage:bannerStorage}),
    avatarStorage:multer({storage:avatarStorage})
 }